/**
 * ReportGear(2011)
 */
package net.abbp.report.view.cell.value;

/**
 * Js数据源对象,当前主要处理薪酬对象
 * 
 * @version 1.0 2011-7-27
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since Report 1.0
 */
public class JsDataValue extends AbstractCellObject {
    // 普通
    public static final int TYPE_NORMAL = 0;
    // 相片
    public static final int TYPE_PHOTO = 1;
    // 公式
    public static final int TYPE_FORMULA = 2;
    // 数据源Id
    private String dataSourceId;
    // 数据源标签
    private String dataSourceCaption;
    // 字段名
    private String field;
    // 字段标签
    private String fieldCaption;
    // 扩展
    private boolean expand = false;
    // 类型
    private int type = TYPE_NORMAL;
    // 公式
    private String formula;

    @Override
    public String toString() {
        if (this.type == TYPE_FORMULA) {
            return ":" + this.formula;
        } else {
            return this.dataSourceCaption + "." + this.fieldCaption;
        }
    }

    /**
     * 设置数据源Id
     * 
     * @param dataSourceId
     *            数据源Id
     */
    public void setDataSourceId(String dataSourceId) {
        this.dataSourceId = dataSourceId;
    }

    /**
     * 获取数据源Id
     * 
     * @return 数据源Id
     */
    public String getDataSourceId() {
        return dataSourceId;
    }

    /**
     * 设置字段
     * 
     * @param field
     *            字段
     */
    public void setField(String field) {
        this.field = field;
    }

    /**
     * 获取字段
     * 
     * @return 字段
     */
    public String getField() {
        return field;
    }

    public void setDataSourceCaption(String dataSourceCaption) {
        this.dataSourceCaption = dataSourceCaption;
    }

    public String getDataSourceCaption() {
        return dataSourceCaption;
    }

    public void setFieldCaption(String fieldCaption) {
        this.fieldCaption = fieldCaption;
    }

    public String getFieldCaption() {
        return fieldCaption;
    }

    public void setExpand(boolean expand) {
        this.expand = expand;
    }

    public boolean isExpand() {
        return expand;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getType() {
        return type;
    }

    public void setFormula(String formula) {
        this.formula = formula;
    }

    public String getFormula() {
        return formula;
    }
}
